import { createRouter, createWebHashHistory } from "vue-router"

import Admin from "~/layouts/admin.vue";
import Index from "~/pages/index.vue"
import Login from "~/pages/login.vue"
import NotFound from "~/pages/404.vue"
import Course from '~/pages/course.vue'
import Exam from '~/pages/exam.vue'
import File from '~/pages/file.vue'
import Feedback from '~/pages/feedback.vue'
import Announce from '~/pages/announce.vue'
import UserInfo from '~/pages/userInfo.vue'
import StuCenter from '~/pages/userInfo/stuCenter.vue'
import VideoSignLog from '~/pages/userInfo/videoSignLog.vue'
import ExamSignLog from '~/pages/userInfo/examSignLog.vue'
import ExamScore from '~/pages/userInfo/examScore.vue'
import StuHonor from '~/pages/userInfo/stuHonor.vue'
import Period from "~/pages/course/period.vue"
import ExamPaper from "~/pages/exam/ExamPaper.vue"
import Result from "~/pages/exam/result.vue"
import TrueResult from "~/pages/exam/trueResult.vue"
import AnnoContent from '~/pages/announce/annoContent.vue'
import LivePlayback from '~/pages/userInfo/livePlayback.vue'
import LivePlayback1 from '~/pages/live/livePlayback.vue'

const routes = [
    {
        path: "/",
        component: Admin,
        // 子路由
        children: [{
            path: "/",
            component: Index,
            meta: {
                title: "后台首页",
            }
        }, {
            path: "/course",
            component: Course,
            meta: {
                title: "课程",
            }
        }, {
            path: "/exam",
            component: Exam,
            meta: {
                title: "考试",
            }
        }, {
            path: "/file",
            component: File,
            meta: {
                title: "资源",
            }
        }, {
            path: "/feedback",
            component: Feedback,
            meta: {
                title: "反馈",
            }
        }, {
            path: "/announce",
            component: Announce,
            meta: {
                title: "公告",
            }
        }, {
            path: "/course/period",
            component: Period,
            meta: {
                title: "课时列表",
            },
        }, {
            path: "/exam/examPaper",
            component: ExamPaper,
            meta: {
                title: "试卷答题",
            },
        }, {
            path: "/exam/result",
            component: Result,
            meta: {
                title: "答题结果",
            },
        }, {
            path: "/exam/trueResult",
            component: TrueResult,
            meta: {
                title: "正确答案",
            },
        }, {
            path: "/announce/annoContent",
            component: AnnoContent,
            meta: {
                title: "通知详情",
            },
        }, {
            path: '/live/livePlayback',
            component: LivePlayback1,
            meta: {
                title: "录播学习"
            }
        }]
    },
    {
        path: "/login",
        component: Login,
        meta: {
            title: "登录页",
        }
    }, {
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component: NotFound
    }, {
        path: '/userInfo',
        name: 'UserInfo',
        redirect: '/userInfo/stuCenter',
        component: UserInfo,
        // 子路由
        children: [{
            path: '/userInfo/stuCenter',
            component: StuCenter,
            meta: {
                title: "学员信息"
            }
        }, {
            path: '/userInfo/videoSignLog',
            component: VideoSignLog,
            meta: {
                title: "课程签到"
            }
        }, {
            path: '/userInfo/examSignLog',
            component: ExamSignLog,
            meta: {
                title: "考试签到"
            }
        }, {
            path: '/userInfo/examScore',
            component: ExamScore,
            meta: {
                title: "考试成绩"
            }
        }, {
            path: '/userInfo/livePlayback',
            component: LivePlayback,
            meta: {
                title: "录播学习"
            }
        },{
            path: '/userInfo/stuHonor',
            component: StuHonor,
            meta: {
                title: "培训证书"
            }
        }]
    }]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router
